package com.ruoyi.whzj.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.whzj.mapper.WhMemberlevelMapper;
import com.ruoyi.whzj.domain.WhMemberlevel;
import com.ruoyi.whzj.service.IWhMemberlevelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 会员级别Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-16
 */
@Service
public class WhMemberlevelServiceImpl implements IWhMemberlevelService 
{
    @Autowired
    private WhMemberlevelMapper whMemberlevelMapper;

    /**
     * 查询会员级别
     * 
     * @param id 会员级别ID
     * @return 会员级别
     */
    @Override
    public WhMemberlevel selectWhMemberlevelById(String id)
    {
        return whMemberlevelMapper.selectWhMemberlevelById(id);
    }

    @Override
    public WhMemberlevel selectMemberLevelByUserId(String userId)
    {
        return whMemberlevelMapper.selectMemberLevelByUserId(userId);
    }

    public WhMemberlevel selectMemberLevelByNumber(String number){
        return whMemberlevelMapper.selectMemberLevelByNumber(number);
    }

    /**
     * 查询会员级别列表
     * 
     * @param whMemberlevel 会员级别
     * @return 会员级别
     */
    @Override
    public List<WhMemberlevel> selectWhMemberlevelList(WhMemberlevel whMemberlevel)
    {
        return whMemberlevelMapper.selectWhMemberlevelList(whMemberlevel);
    }

    /**
     * 新增会员级别
     * 
     * @param whMemberlevel 会员级别
     * @return 结果
     */
    @Override
    public int insertWhMemberlevel(WhMemberlevel whMemberlevel)
    {
        whMemberlevel.setId(IdWorker.getId());
        whMemberlevel.setCreateTime(DateUtils.getNowDate());
        return whMemberlevelMapper.insertWhMemberlevel(whMemberlevel);
    }

    /**
     * 修改会员级别
     * 
     * @param whMemberlevel 会员级别
     * @return 结果
     */
    @Override
    public int updateWhMemberlevel(WhMemberlevel whMemberlevel)
    {
        whMemberlevel.setUpdateTime(DateUtils.getNowDate());
        return whMemberlevelMapper.updateWhMemberlevel(whMemberlevel);
    }

    /**
     * 删除会员级别对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWhMemberlevelByIds(String ids)
    {
        return whMemberlevelMapper.deleteWhMemberlevelByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除会员级别信息
     * 
     * @param id 会员级别ID
     * @return 结果
     */
    @Override
    public int deleteWhMemberlevelById(String id)
    {
        return whMemberlevelMapper.deleteWhMemberlevelById(id);
    }
}
